﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Abp.Auditing;
using GN.Pay.Application.GatewayApp;
using System.Web.Mvc;
using GN.Pay.Application.GatewayApp.Dto.Output;
using Abp.Web.Models;
using Abp.Web.Mvc.Controllers.Results;
using System.Text;

namespace GN.Pay.GatewayWeb.Controllers.PayRoute
{
    /// <summary>
    /// 
    /// </summary>
    [PayRoute(Channel_Id)]
    class GybProtocolPayRoute : APayActionRoute
    {
        public const string Channel_Id = "Gyb.ProtocolPay";

        /// <summary>
        /// 
        /// </summary>
        /// <param name="clientInfo"></param>
        /// <param name="service"></param>
        public GybProtocolPayRoute(IClientInfoProvider clientInfo, ITradeApplyAppService service)
            : base(clientInfo, service)
        {
        }

        public override string ChannelId
        {
            get
            {
                return Channel_Id;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public override bool IsSupportWap
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        /// <param name="viewResultFactory"></param>
        /// <returns></returns>
        protected override ActionResult ViewResult(PayChannelOutput output, Func<string, object, ActionResult> viewResultFactory)
        {
            var data = new AjaxResponse(output);
            return new AbpJsonResult
            {
                Data = data,
                ContentType = "json",
                ContentEncoding = Encoding.UTF8,
                JsonRequestBehavior = JsonRequestBehavior.DenyGet,
                CamelCase = true,
                Indented = false
            };
        }
    }
}